<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>我的订单</title>
<%@include file="/pages/common/head.jsp"%>
<style type="text/css">
	h1 {
		text-align: center;
		margin-top: 200px;
	}
</style>
</head>
<body>
	
	<div id="header">
			<img class="logo_img" alt="" src="static/img/logo.gif" >
			<span class="wel_word">我的订单</span>
		<%@include file="/pages/common/login_success_menu.jsp"%>
	</div>
	
	<div id="main">
		
		<table>
			<tr>
				<td>日期</td>
				<td>金额</td>
				<td>状态</td>
				<td>详情</td>
			</tr>
			<c:if test="${empty sessionScope.myOrders}">
				<tr>
					<td colspan="4">
						<a href="index.jsp">
							亲爱的用户,您还没有订单，快去下单吧!
						</a>
					</td>
				</tr>
			</c:if>
			<c:if test="${not empty sessionScope.myOrders}">
				<c:forEach items="${sessionScope.myOrders}" var="myOrder">
					<tr>
						<td>${myOrder.createTime}</td>
						<td>${myOrder.price}</td>
						<td>
							<c:if test="${myOrder.status == 0}">
								<span>未发货</span>
							</c:if>
							<c:if test="${myOrder.status == 1}">
								<script type="text/javascript">
									$(function () {
										$("a.receiverOrder").click(function () {
											return confirm("确认收货?");
										})
									});
								</script>
								<a class="receiverOrder" href="orderServlet?action=receiverOrder&orderId=${myOrder.orderId}">已发货</a>
							</c:if>
							<c:if test="${myOrder.status == 2}">
								<span>已完成</span>
							</c:if>
						</td>
						<td><a href="orderServlet?action=showOrderDetail&orderId=${myOrder.orderId}">查看详情</a></td>
					</tr>
				</c:forEach>
			</c:if>
		</table>
	</div>
	<%@include file="/pages/common/last.jsp"%>
</body>
</html>